package controller;

import java.net.InetAddress;
import java.util.Date;

public class Contact {
	
	protected String username;
	protected InetAddress ipAddr;
	protected Date lastHeartBeat;
	
	public Contact(String username, InetAddress ipAddr, Date helloTime) {
		this.username = username;
		this.ipAddr = ipAddr;
		this.lastHeartBeat = helloTime;
	}
	
	public String getUsername()
	{
		return this.username;
	}
	
	public InetAddress getIpAddr()
	{
		return this.ipAddr;
	}

	public Date getLastHeartBeat()
	{
		return this.lastHeartBeat;
	}
	
	public void updateHeartBeat(Date heartBeatTime)
	{
		this.lastHeartBeat = heartBeatTime;
	}
	
	@Override
	public String toString()
	{
		return username + "@" + ipAddr.getHostAddress(); // + "\nLastHeartBeat at " + lastHeartBeat.getTime() + " secondes.";
	}
}
